#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QtGui>
#include <QString>
#include "/windows/D/svn/preplayer/engine_cpp/adaptors.h"
#include "plst.h"
#include "equalizer.h"
#include "vis_draw.h"
//This class managed all UI for player such as creation equalizer and visualizer and playlist

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT
    
public:
    explicit MainWindow(QWidget *parent = 0);
    void pl_timer_run();
    void pl_timer_stop();
    ~MainWindow();

public slots:
      void slot_play(void);//playback slots
      void slot_play_next(void);
      void slot_play_prev(void);
      void slot_stop(void);
      void slot_pause(void);
      void slot_volume(void);
      void slot_playb_timer(void);

      void slot_pos_move(void);// position slots
      void slot_slide_start(void); //signals of start sliding
      void slot_slide_stop(void); //signals of start sliding

      void slot_visualizator_toogle(bool state);
      void slot_equalizer_toogle(bool state);


      void slot_cover_toogle(bool state);
      void slot_tags_toogle(bool state);

      void slot_plst_dblclk(QListWidgetItem *item);
      void slot_set_eq(void);
      void slot_repaint(void);

protected:
      void keyReleaseEvent(QKeyEvent *);

private:
    Ui::MainWindow *ui;
    HSTREAM hndl;//handle to stream
    plst *playlist;
    QTimer pl_timer, dr_timer;//playback timer

    Equalizer *eq;//equalizer

    vis_draw *visualizator;//visualizator
    QGraphicsView *view;
    QTableWidget *tags;

    unsigned *mywave;
    float *myfft;
    bool playb_sliding, paused;
    void play(QString str);

    void init_connections(void);
    void init_volume(void);
    void init_playlist(void);
    void init_timers(void);
    void init_eq(void);
    void init_vis(void);

    int MYWAVE_LEN, MYFFT_LEN;
    bool is_visualizator_present;
    bool is_equalizer_present;
    bool is_tags_present;
    bool is_cover_present;
};

#endif // MAINWINDOW_H
